package com.hqyj.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description
 * @Autor 伍军
 * @Date 2022/10/18 10:40
 * @Version 1.0
 **/
@RestController
@RequestMapping("/email")
public class EmailController {

    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("/sendCode")
    public String sendCode(String email,String id){
        Map<String,Object> map =  new HashMap<>();
        map.put("email",email);
        map.put("id",id);
        //发送消息到mq中
        rabbitTemplate.convertAndSend("helloExchange","helloRoute01",map);

        return "success";
    }


}
